/**
 * @author liangxi
 * @since 2023/12/21
 */

#ifndef DESIGNPATTERN_CURRENTCONDITIONSDISPLAY_H
#define DESIGNPATTERN_CURRENTCONDITIONSDISPLAY_H

#include <iostream>
#include "../Observer.h"
#include "../DisplayElement.h"
#include "../../Subject/Subject.h"

namespace Observer {

    class CurrentConditionsDisplay : public Observer, public DisplayElement {
    public:
        CurrentConditionsDisplay() = default;

        void display() override {
            std::cout << "Current conditions: " << temperature
                      << "F degrees and " << humidity
                      << "% humidity" << std::endl;
        }

        void update(float temp, float humidity, float pressure) override {
            this->temperature = temp;
            this->humidity = humidity;
            display();
        }

    private:
        float temperature;
        float humidity;
    };

} // Observer

#endif //DESIGNPATTERN_CURRENTCONDITIONSDISPLAY_H
